package com.jt.controller;

import com.jt.pojo.User;
import com.jt.service.UserService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@MapperScan("com.jt.mapper")
@RequestMapping("user")
@Component
public class UserController {

    //象网页中显示数据

    //DI注入
    @Resource
    private UserService userService;

@RequestMapping("getInfo")
    public List<User>  getInfo(){
     //使用mybatis-plus的方式返回数据
        return userService.getAll();
    }
}
